<template>
	<section class="jumbotron">
		<h3 class="jumbotron-heading">搜索github用户</h3>
		<div>
			<input
				type="text"
				placeholder="输入用户名"
				v-model="keyword"
			/>&nbsp;<button @click="handleSearch">搜索</button>
		</div>
	</section>
</template>

<script>
	import axios from 'axios'

	export default {
		name:'Search',
		data() {
			return {
				keyword:''
			}
		},
		methods: {
			handleSearch(){
				axios.get('https://api.github.com/search/users?q='+this.keyword).then(
					response => {
						console.log('成功了',response.data.items)
					},
					error => {
						console.log('失败了',error)
					}
				)
			}
		},
	}
</script>